const form = {
  state: {
    formData: {}
  },
  // 赋值
  mutations: {
    setPrecessform: (state, value) => {
      // 如果vuex事先存了值, 表单切换回来时赋值回去
      setTimeout(() => {
        for (let key in state.formData) {
          if (!value[key] && state.formData[key]) {
            // console.log('---', key, state.formData[key], value[key])
            value[key] = state.formData[key]
          }
        }
        // console.log('value', value)
        state.formData = value
      }, 500)
    },
    setPrecessformValue: (state, [key, value]) => {
      state.formData[key] = value
    }
  },
  // 初始化
  actions: {},

  // 取值
  getters: {}
}

export default form